$(".am-form").submit(function () {
    var formData = $('.am-form').serialize();
    $.ajax({
        url:'/dopregister',
        data:formData,
        type:'post',
        dataType:'json',
        success:function (data) {
            if (data['status'] == 1){
                layer.msg("注册成功！",{offset:"50%",icon:6,time:1000},function () {
                    location.href = 'plogin';
                });
            } else if(data['status'] == 2){
                layer.msg("必填项不能为空",{offset:"50%",icon:6,time:1000},function () {
                    location.reload();
                })
            } else {
                layer.msg("注册失败！您可能已经注册过",{offset:"50%",icon:6,time:1000},function () {
                    location.reload();
                });
            }
        }
    })
    return false;
});